home *** CD-ROM | disk | FTP | other *** search
- TRIG(3M) Last changed: 2-2-99
-
-
- NNAAMMEE
- ssiinn, ccooss, ttaann, aassiinn, aaccooss, aattaann, aattaann22, ffssiinn, ssiinnff, ffccooss, ccoossff, ffttaann,
- ttaannff, ffaassiinn, aassiinnff, ffaaccooss, aaccoossff, ffaattaann, aattaannff, ffaattaann22, aattaann22ff, ssiinnll,
- ccoossll, ttaannll, aassiinnll, aaccoossll, aattaannll, aattaann22ll - trigonometric functions and
- their inverses
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<mmaatthh..hh>>
-
- ddoouubbllee ssiinn((ddoouubbllee _x));;
- ffllooaatt ffssiinn((ffllooaatt _x));;
- ffllooaatt ssiinnff((ffllooaatt _x));;
- lloonngg ddoouubbllee ssiinnll((lloonngg ddoouubbllee _x));;
-
- ddoouubbllee ccooss((ddoouubbllee _x));;
- ffllooaatt ffccooss((ffllooaatt _x));;
- ffllooaatt ccoossff((ffllooaatt _x));;
- lloonngg ddoouubbllee ccoossll((lloonngg ddoouubbllee _x));;
-
- ddoouubbllee ttaann((ddoouubbllee _x));;
- ffllooaatt ffttaann((ffllooaatt _x));;
- ffllooaatt ttaannff((ffllooaatt _x));;
- lloonngg ddoouubbllee ttaannll((lloonngg ddoouubbllee _x));;
-
- ddoouubbllee aassiinn((ddoouubbllee _x));;
- ffllooaatt ffaassiinn((ffllooaatt _x));;
- ffllooaatt aassiinnff((ffllooaatt _x));;
- lloonngg ddoouubbllee aassiinnll((lloonngg ddoouubbllee _x));;
-
- ddoouubbllee aaccooss((ddoouubbllee _x));;
- ffllooaatt ffaaccooss((ffllooaatt _x));;
- ffllooaatt aaccoossff((ffllooaatt _x));;
- lloonngg ddoouubbllee aaccoossll((lloonngg ddoouubbllee _x));;
-
- ddoouubbllee aattaann((ddoouubbllee _x));;
- ffllooaatt ffaattaann((ffllooaatt _x));;
- ffllooaatt aattaannff((ffllooaatt _x));;
- lloonngg ddoouubbllee aattaannll((lloonngg ddoouubbllee _x));;
-
- ddoouubbllee aattaann22((ddoouubbllee _y,, ddoouubbllee _x));;
- ffllooaatt ffaattaann22((ffllooaatt _y,, ffllooaatt _x));;
- ffllooaatt aattaann22ff((ffllooaatt _y,, ffllooaatt _x));;
- lloonngg ddoouubbllee aattaann22ll((lloonngg ddoouubbllee _y lloonngg ddoouubbllee _x));;
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- The single-precision and long double-precision routines listed above
- are only available in the standard math library, --llmm, and in --llmmxx.
-
- ssiinn, ccooss and ttaann return trigonometric functions of radian arguments _x
- for double data types. ffssiinn, ffccooss and ffttaann, and their ANSI-named
- counterparts ssiinnff, ccoossff and ttaannff return trigonometric functions of
- radian arguments _x for float data types. ssiinnll, ccoossll and ttaannll do the
- same for long double data types.
-
- The aassiinn routines return the arc sine in the range -_p_i/2 to _p_i/2. The
- type of both the return value and the single argument are double for
- aassiinn, float for ffaassiinn and its ANSI-named counterpart aassiinnff, and long
- double for aassiinnll.
-
- The aaccooss routines return the arc cosine in the range 0 to _p_i. The
- type of both the return value and the single argument are double for
- aaccooss, float for ffaaccooss and its ANSI-named counterpart aaccoossff, and long
- double for aaccoossll.
-
- The aattaann routines return the arc tangent in the range -_p_i/_2 to _p_i/2.
- The type of both the return value and the single argument are double
- for aattaann, float for ffaattaann and its ANSI-named counterpart aattaannff, and
- long double for aattaannll.
-
- The aattaann22 routines return the arctangent of _y/_x in the range -_p_i to _p_i
- using the signs of both arguments to determine the quadrant of the
- return value. Both the return value and the argument types are double
- for aattaann22, float for ffaattaann22 and its ANSI-named counterpart aattaann22ff, and
- long double for aattaann22ll.
-
- NNOOTTEESS
- Functions in the standard math library (lliibbmm..aa) are referred to as
- --llmm; functions in the the BSD math library (lliibbmm4433..aa) are referred to
- as --llmm4433 versions.
-
- The --llmm versions always return the default Quiet NaN and set eerrrrnnoo to
- EDOM when a NaN is used as an argument. A NaN argument usually causes
- the --llmm4433 versions to return the same argument. The --llmm4433 versions
- never set eerrrrnnoo.
-
- If ||_x|| >> 11, the --llmm versions of the aassiinn and aaccooss functions set eerrrrnnoo
- to EDOM and return NaN. When the argument is greater than one, the
- return value of the --llmm4433 versions is indeterminate.
-
- The aattaann22 functions return zero if both arguments are zero. The --llmm
- versions also set eerrrrnnoo to EDOM. An exception is the --llmm4433 versions,
- which return the following results:
-
- atan2(0.0, 0.0) = 0.0
- atan2(-0.0, 0.0) = -0.0
- atan2(0.0, -0.0) = pi
-
- This matches the proposed ANSI C9X Standard.
-
- The --llmm versions also set eerrrrnnoorr to EDOM for these arguments.
-
- See mmaatthheerrrr(3M) for a description of error handling for --llmmxx
- functions.
-
- The single precision routines ffssiinn, ffccooss, and ffttaann are accurate to
- within 1 ULP for arguments in the range --22****2222 to 22****2222. Double
- precision routines ssiinn, ccooss, and ttaann are accurate to within 2 ULP for
- arguments in the range --22****2288 to 22****2288. Arguments larger than this
- lose precision rapidly, but retain more than 20 bits precision out to
- ++//--22****5500 for the double routines.
-
- Long double operations on this system are only supported in round to
- nearest rounding mode (the default). The system must be in round to
- nearest rounding mode when calling any of the long double functions,
- or incorrect answers result.
-
- Users concerned with portability to other computer systems should note
- that the long double and float versions of these functions are
- optional according to the ANSI C Programming Language Specification
- ISO/IEC 9899 : 1990 (E).
-
- Long double functions are named to be compliant with the ANSI-C
- standard; however, to be backward compatible, they may still be called
- with the double precision function name prefixed with a qq.
-
- The following are reasons for assigning a value to aattaann22((00,,00)):
-
- * Programs that test arguments to avoid computing aattaann22((00,,00)) must be
- indifferent to its value. Programs that require it to be invalid
- are vulnerable to diverse reactions to that invalidity on diverse
- computer systems.
-
- * aattaann22 is used mostly to convert from rectangular ((xx,,yy)) to polar
- (_r,_t_h_e_t_a) if coordinates that must satisfy xx = (_r*ccooss _t_h_e_t_a) and yy =
- (_r*ssiinn _t_h_e_t_a). These equations are satisfied when ((xx==00,,yy==00)) is
- mapped to ((rr==00,,tthheettaa==00)). In general, conversions to polar
- coordinates should be computed as follows:
-
- r:= hypot(x,y); . . . := sqrt(x*x+y*y)
- theta:= atan2(y,x)
-
- * The previous formulas do not have to be altered to cope in a
- reasonable way with signed zeros and infinities on machines, such as
- SGI 4D machines, that conform to IEEE 754; the versions of hhyyppoott and
- aattaann22 provided for such a machine are designed to handle all cases.
- That is why aattaann22((++--00,,--00)) == ++--_p_i.
-
- In general, the formulas above are equivalent to these:
-
- r := sqrt(x*x+y*y); if r = 0 then x := copysign(1,x);
- if x > 0 then theta := 2*atan(y/(r+x))
- else theta := 2*atan((r-x)/y);
-
- This is the case except if _r is infinite; then aattaann22 will yield an
- appropriate multiple of _p_i/4 that would otherwise have to be obtained
- by taking limits.
-
- SSEEEE AALLSSOO
- mmaatthh(3M), hhyyppoott(3M), ssqqrrtt(3M), mmaatthheerrrr(3M)
-
- The Fortran version of these routines:
- ssiinn(3F), ccooss(3F), ttaann(3F), aassiinn(3F), aaccooss(3F), aattaann(3F), aattaann22(3F)
-
- This man page is available only online.
-